import os
import sys
from pathlib import Path

# App 版本
APP_VERSION = "0.2.5"

if getattr(sys, 'frozen', False):
    # 打包后的可执行文件
    base_path = os.path.dirname(os.path.realpath(sys.executable))
else:
    # 原始的 Python 脚本
    base_path = Path(__file__).resolve().parent

BASE_PATH = base_path
# 根目录路径
MAIN_PATH = Path(__file__).resolve().parent


# 获取用户主目录
USER_HOME_PATH = os.path.expanduser("~")

# 构建 data 文件夹的路径
DATA_PATH = os.path.join(USER_HOME_PATH, "AppData", "FuReader")

VERSION_URL = "https://gitee.com/fuadmin/fu-csv-reader/raw/master/config.py"
UPDATE_INFO = ("1.Sync Data from table to table.\n2. fix some bug.")


def get_new_version_url(new_version):
    return f"http://j031m01x.go.johnsoncontrols.com:9090/basic-api/api/system/download/Fu%20Reader-{new_version}.zip"